{extend name="layout" /}
{block name="head"}
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
{/block}
{block name="content"}
<div class="table-margin">
    <table class="table table-bordered table-header" id="list-table">
        <thead>
        <tr>
            <td>注册日期</td>
            <td>身份证号</td>
            <td>就诊医院</td>
            <td class="w20">操作</td>
        </tr>
        </thead>
        <tbody>
        {foreach name="list" item="vo"}
            <tr>
                <td>{$vo['register_time']}</td>
                <td>{$vo['user_name']}</td>
                <td>宁波鄞州第二人民医院</td>
                <td>{$vo['operate']}</td>
            </tr>
        {/foreach}
        </tbody>
        <tfoot>
        <tr>
            <td colspan="10">
                <div class="pull-right">
                    <nav>
                        <ul class="pagination">{$list->render()}</ul>
                    </nav>
                </div>
            </td>
        </tr>
        </tfoot>
    </table>
</div>
<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title"> 修改患者</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="{:url('member/edit')}" method="post">
                    <table class="table table-bordered contact-template-form">
                        <tbody>
                        <tr>
                            <td width="20%" align="right">就诊医院：</td>
                            <td>
                                <input class="form-control" type="text" value="宁波鄞州第二人民医院" readonly/>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right">患者编号：</td>
                            <td>
                                <input class="form-control" name="id" type="text" readonly/>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right">身份证号：</td>
                            <td>
                                <input class="form-control card" type="text" maxlength="18" name="user_name" oninput="value=value.replace(/[^0-9.]/g,'')" required=""/>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right">注册日期：</td>
                            <td>
                                <input class="form-control date" type="text" readonly/>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary" type="submit" value="修改">
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function edit(id,name,date){
        $("input[name='id']").val(id);
        $("input[name='user_name']").val(name);
        $(".date").val(date);
        $('#bjy-edit').modal('show');
    }
    function reset(id){
        layer.confirm('确认重置此患者密码吗?', {icon: 3, title:'提示'}, function(index){
            $.getJSON("{:url('member/reset')}", {'id' : id}, function(res){
                if(1 == res.code){
                    layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                        window.location.reload();
                    });
                }else{
                    layer.alert(res.msg, {title: '友情提示', icon: 2});
                }
            });
            layer.close(index);
        })
    }
    function deleteMember(id){
        layer.confirm('确认删除此患者?', {icon: 3, title:'提示'}, function(index){
            //do something
            $.getJSON("{:url('member/delete')}", {'id' : id}, function(res){
                if(1 == res.code){
                    layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                        window.location.reload();
                    });
                }else{
                    layer.alert(res.msg, {title: '友情提示', icon: 2});
                }
            });
            layer.close(index);
        })
    }
    $(function () {
        // 编辑节点
        $('#bjy-edit form').submit(function(){
            $(this).ajaxSubmit({
                success:showSuccess
            });
            return false;
        });
    });
</script>
{/block}
